{extend name="public:base" /}
{block name="content"}
<div class="page-header">
	<h1>
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb6}
		</small>
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$crumbs}
		</small>			
	
	</h1>
</div>
<form id="myForm" action="{:url('Contract/issue_update')}" method="post">
	

<div class="row">
	<div class="col-xs-12">	
		
		<div class="form-horizontal">
			<input type="hidden" name="id" value="{$info.id}"/>
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left" for="exchange_id"> * 交易所 </label>
			<div class="col-sm-11">
				<div class="clearfix">
					<select name="exchange_id" style="width: 200px;"  id ="exchange_id" tabindex="4">
						<option value ="-1">--请选择交易所--</option>
						{volist name="exchange" id="p" empty="$exchange"}
						<option value ="{$p.id}" {if condition="$p.id eq $info.exchange_id"} selected {/if} >{$p.name}</option>
						{/volist}
					</select>
				</div>
			</div>
			</div>	
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left" for="variety_id"> 交易品种</label>
			<div class="col-sm-11">
				<div class="clearfix">
					<select name="variety_id" id ="variety_id" style="width: 200px;" tabindex="4">
						<option value ="{$info.variety_id}">{:get_variety_name($info.variety_id)}</option>
					</select>
				</div>
			</div>
			</div>
			<div class="form-group">
                <label class="col-sm-1 control-label" for="issue">发行价</label>
                <div class="col-sm-11">
                  <input type='number' step="0.01" name="issue" id="issue" value="{$info.issue}"/>
                </div>
          	</div>
          	<div class="form-group">
                <label class="col-sm-1 control-label" for="target">目标价</label>
                <div class="col-sm-11">
                  <input type='number' step="0.01" name="target" id="target" value="{$info.target}" />
                </div>
          	</div>
			<div class="form-group">
				<label class="col-sm-1 control-label" for="remark">备注</label>
				<div class="col-sm-11">
					<textarea name="remark" id="remark" >{$info.remark}</textarea>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left"> </label>	
				<div class="col-sm-11">
					<input id="send" type="submit" value="提交" class="btn btn-primary" />
				</div>
			</div>
		</div>
	</div>
	</div>
</form>
{/block}
{block name="javascript"}
<script src="__PUBLIC__/js/ckeditor/ckeditor.js"></script> 
<script>
CKEDITOR.replace('description', {
	filebrowserImageUploadUrl: '{:url("FileManager/ckupload")}',
	toolbar: [
				[ 'Source', 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ],
				[ 'FontSize', 'TextColor', 'BGColor' ],
				[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','Image','Format']
			]	
});

</script>
<script>

$('#send').click(function(){
    //alert('abc');
	var exchange_id = $("#exchange_id").val();
	var variety_id = $("#variety_id").val();
	var issue = $("#issue").val();
	var target= $("#target").val();
	if(exchange_id=="-1")
	{	
		alert('请选择交易所');
		return false;
	}

	if(variety_id=="-1")
	{	
		alert('请选择交易品种');
		return false;
	}

	if(issue=="" || issue==null)
	{	
		alert('请输入发行价');
		return false;
	}

	if(target=="" || target==null)
	{	
		alert('请输入目标价');
		return false;
	}

	document.getElementById("myForm").submit();

});

</script>

<script type="text/javascript">
	$('#exchange_id').change(function(){
		//alert("abc");
		var iframe_array = <?php echo  json_encode($variety);   ?>;
    	var checkValue=jQuery("#exchange_id").val();
    	//alert(checkValue);
    	$("#variety_id").empty();  
    	for (var i = 0; i <iframe_array.length ; i++) 
    	{
    		if(iframe_array[i]['exchange_id']==checkValue)
	    	{
	    		var opt = "<option value='"+iframe_array[i]['id']+"'>"+iframe_array[i]['name']+"</option>";
	    		jQuery("#variety_id").append(opt);
	    	}
	    }

	})

</script>


{/block}